//
//  GlobalHeader.h
//  ZCTp_ios
//
//  Created by cherry pu on 2017/11/27.
//  Copyright © 2017年 zhangXin. All rights reserved.
//

#ifndef GlobalHeader_h
#define GlobalHeader_h

#define SuppressPerformSelectorLeakWarning(Stuff) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
Stuff; \
_Pragma("clang diagnostic pop") \
} while (0)

//    屏幕的宽高度
#define SCREEN_SIZE   [UIScreen mainScreen].bounds.size

#define SCREEN_WIDTH  ([UIScreen mainScreen].bounds.size.width)

#define SCREEN_STATUS_BAR_HEIGHT ([[UIApplication sharedApplication] statusBarFrame].size.height)


#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

#define WEAKSELF typeof(self) __weak weakSelf = self;

#define STRONGSELF typeof(weakSelf) __strong strongSelf = weakSelf;

#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640.0, 960.0), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640.0, 1136.0), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750.0, 1334.0), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6p ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242.0, 2208.0), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPad ([[UIDevice currentDevice].model myContainsString:@"iPad"])

// 沙盒路路径
#define DocumentsPath [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]
// 随机色
#define DreamRandomColor DreamColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))
#define DreamColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define DreamColorWithAlpha(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]


#define COLOR_LINE  [UIColor colorWithR:221 G:221 B:221]
#define COLOR_BG    [UIColor colorWithR:246 G:246 B:246]

#define COLOR_MAIN  [UIColor colorWithR:255 G:99 B:0]

#define MainColor(a)    [UIColor colorWithR:253 G:102 B:0 A:(a)]

#define QN_BASE_URL         @"http://olrrbsfxt.bkt.clouddn.com/"

#define DEVICE_ID [[UIDevice currentDevice].identifierForVendor UUIDString]
#define APPLICATION_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]



/** 手机型号判断 */
#define isIPhone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define isIPhoneX (SCREEN_WIDTH >= 375.0f && SCREEN_HEIGHT >= 812.0f && isIPhone)

//底部安全高度
#define BOTTOM_SAFE_HEIGHT (isIPhoneX ? 34 : 0)
//系统手势高度
#define SYSTEM_GESTURE_HEIGHT (isIPhoneX ? 13 : 0)
//tabbar高度
#define TABBAR_HEIGHT (49 + BOTTOM_SAFE_HEIGHT)
//状态栏高度
#define STATUS_HEIGHT (isIPhoneX ? 44 : 20)
//导航栏高
#define NAVBAR_HEIGHT 44
/** 6位十六进制颜色转换 */
#define UIColorFromRGB(rgbValue) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

// View 圆角和加边框
#define ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

// View 圆角
#define ViewRadius(View, Radius)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES]

#endif /* GlobalHeader_h */
